Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
// | |
// _oo0oo_ | |
// o8888888o | |
// 88" . "88 | |
// (| -_- |) | |
// 0\ = /0 | |
// ___/`---'\___ | |
// .' \\| |// '. | |
// / \\||| : |||// \ | |
// / _||||| -:- |||||- \ |
/** | |
* This is a sample webhook server that listens for webhook | |
* callbacks coming from Trello, and updates any cards that are | |
* added or modified so everyone knows they are "PRIORITY" | |
* | |
* To get started | |
* * Add your key and token below | |
* * Install dependencies via `npm install express request body-parser` | |
* * Run `node app.js` on a publicly visible IP | |
* * Register your webhook and point to http://<ip or domain>:3123/priority |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
// Source: http://www.carronmedia.com/uk-postal-counties-list | |
array( | |
'England' => array( | |
'Avon', | |
'Bedfordshire', | |
'Berkshire', | |
'Buckinghamshire', |
<head>((?!</head>).|\n)+</head> |
mogrify -path ./output -distort barrel '0.06335 -0.18432 -0.10618' ./*.JPG |
<?php | |
namespace App\Console\Commands\Telescope; | |
use Illuminate\Console\Command; | |
use Illuminate\Support\Facades\DB; | |
use Laravel\Telescope\EntryType; | |
class CustomTelescopePrune extends Command | |
{ |
# -*- coding: utf-8 -*- | |
from django.db.models import signals | |
from django.utils.functional import curry | |
from rest_framework import authentication | |
class UserstampMiddleware(object): | |
"""Add user created_by and updated_by foreign key refs to any model automatically. | |
Almost entirely taken from https://github.com/Atomidata/django-audit-log/blob/master/audit_log/middleware.py""" | |
def process_request(self, request): |
<?php | |
namespace Application\BaseBundle\Doctrine\Listener; | |
use Doctrine\ORM\Event\LoadClassMetadataEventArgs; | |
class InheritanceMapping | |
{ | |
protected $mappings; |
The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).
My take-aways are:
You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.
Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse